#ifndef DATAHANDLE
#define DATAHANDLE

#include <QString>
#include <float.h>
#include "data.h"
#include <QObject>

class QSqlQuery;

namespace FEATURE
{
   enum
   {
      ADD = 0,
      DELETE,
      MODIFY,
      SELECT
   };
}

struct MonthAndInnerCardInfo
{
public:
    MonthAndInnerCardInfo(){
        operator_name.clear();
        veh_plate.clear();
        veh_ownner.clear();
        veh_ownner_tel.clear();
        veh_valid_start_time.clear();
        veh_valid_end_time.clear();
        veh_operate_time.clear();
        veh_vip_charge_money.clear();
    }

    void operator=(const MonthAndInnerCardInfo &info)
    {
        operator_name = info.operator_name;
        veh_plate     = info.veh_plate;
        veh_ownner    = info.veh_ownner;
        veh_ownner_tel= info.veh_ownner_tel;
        veh_valid_start_time  = info.veh_valid_start_time;
        veh_valid_end_time    = info.veh_valid_end_time;
        veh_operate_time      = info.veh_operate_time;
        veh_vip_charge_money  = info.veh_vip_charge_money;
    }

public:
    QString operator_name;
    QString veh_plate;
    QString veh_ownner;
    QString veh_ownner_tel;
    QString veh_valid_start_time;
    QString veh_valid_end_time;
    QString veh_operate_time;
    QString veh_vip_charge_money;
};

class DataHandle : public QObject
{
    Q_OBJECT
public:
    static DataHandle* s_pInstance;
    static DataHandle* getInstance();
private:
    DataHandle(QObject * parent = 0){}
public:
    static bool init();
signals:
    void sigMsg(QString str);
public:
    // 处理月卡车辆表
    bool AddMonthVehRecord(const MonthAndInnerCardInfo& info);
    bool DeleteMonthVehRecord(QString strPlate,QString strOwnner);
    bool ModifyMonthVehRecord(const MonthAndInnerCardInfo& info);
    bool SelectMonthVehRecord(QSqlQuery& result,QString strPlate,QString strOwnner);
public:
    // 处理期卡(内部)车辆表
    bool AddOfCardVehRecord(const MonthAndInnerCardInfo& info);
    bool DeleteOfCardVehRecord(QString strPlate,QString strOwnner);
    bool ModifyOfCardVehRecord(const MonthAndInnerCardInfo& info);
    bool SelectOfCardVehRecord(QSqlQuery& result,QString strPlate,QString strOwnner);

};

#endif // DATAHANDLE

